//
//  JiaoyiTypeViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/11/27.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "JiaoyiTypeViewController.h"
#import "JTCSM.h"
#import "ZYRadioButton.h"
#import "MyInfoView.h"

static CGFloat labelHeight = 50;
@interface JiaoyiTypeViewController ()
{
    NSArray *array1;
    NSArray *array2;
}
@end

@implementation JiaoyiTypeViewController
- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [df isRemoveTarbar:YES];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    array1 = @[@"微信支付",@"支付宝支付",@"京东钱包支付",@"银联闪付",@"QQ钱包支付"];
    array2 = @[@"1",@"2",@"5",@"3",@"6"];
    NSArray *iamgeArray = @[@"icon_05@2x.png",@"icon_06@2x.png",@"jingdongpay.png",@"icon_08@2x.png",@"qqpay.png"];
//    icon_08@2x.png
    MyInfoView *view2;
    for (int i = 0; i < array1.count; i++) {
        view2 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, labelHeight*i, KCONTROLLERWith, labelHeight) imagename:[NSString stringWithFormat:@"%@",iamgeArray[i]] title:array1[i] placeholder:nil isShowLabel:RadioButton radioBtnIndex:i GroupId:@"jiaoyitype"];
        view2.tag = 102+i;
        view2.userInteractionEnabled = YES;
        [ZYRadioButton addObserverForGroupId:@"jiaoyitype" observer:self];
        [self.view addSubview:view2];
    }

}

-(void)radioButtonSelectedAtIndex:(NSUInteger)index inGroup:(NSString*)groupId{
    
    [self.delegate getTitle:array1[index] typeid:array2[index]];
    [self gotBack];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
